﻿CREATE TABLE [dbo].[PiPermissionScope] (
    [Id]                   INT            IDENTITY (1, 1) NOT NULL,
    [ResourceCategory]     NVARCHAR (50)  NOT NULL,
    [ResourceId]           NVARCHAR (50)  NOT NULL,
    [TargetCategory]       NVARCHAR (50)  NOT NULL,
    [TargetId]             NVARCHAR (50)  NOT NULL,
    [PermissionId]         INT            NOT NULL,
    [PermissionConstraint] NVARCHAR (200) NULL,
    [StartDate]            SMALLDATETIME  NULL,
    [EndDate]              SMALLDATETIME  NULL,
    [Enabled]              INT            DEFAULT ((1)) NOT NULL,
    [DeleteMark]           INT            DEFAULT ((0)) NOT NULL,
    [Description]          NVARCHAR (800) NULL,
    [CreateOn]             DATETIME       DEFAULT (getdate()) NOT NULL,
    [CreateBy]             NVARCHAR (50)  NULL,
    [CreateUserId]         NVARCHAR (50)  NULL,
    [ModifiedOn]           DATETIME       NULL,
    [ModifiedBy]           NVARCHAR (50)  NULL,
    [ModifyUserId]         NVARCHAR (50)  NULL,
    CONSTRAINT [PK_PIPERMISSIONSCOPE] PRIMARY KEY NONCLUSTERED ([Id] ASC)
);

